﻿@using KRM.Core
@model IEnumerable<KRM.Core.vParagonUnplanOrder>

<table class="table table-bordered table-fix tbl-selected krmtable" id="tb-paragonunplanorders" data-countall='@Model.Count()' data-countnonedelivery='@(Model.Count() - Model.Count(p => p.carrierName == "Kybotech Delivery Service"))'>
    <thead id="tb-paragonunplanorders-head">
        <tr>
            <th>Action</th>
            <th>DatePlaced</th>
            <th>OrderRef</th>
            <th>Postcode</th>
            <th>Customer</th>
            <th>Telephone1</th>
            <th>Mobile</th>
            <th>Qty</th>
            <th>Product</th>
            <th>Special Instructions</th>
            <th>Weight KG</th>
            <th>Address</th>
            <th>CarrierName</th>
            <th>Packages</th>
            <th>Telephone2</th>
            <th>ProdOptionID</th>
            <th>OrderID</th>
            <th>OrderItemID</th>
            <th>LoadItemStatus</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            var color = item.LoadItemStatus == LoadItemStatus.REPLAN.ToString() ? "color:red" : "";
            
            <tr style="@color" onclick="paragonunplanorderselected('@item.OrderRef', '@item.OrderID')" 
                @(item.carrierName == "Kybotech Delivery Service" ? "class=ShowDeliveryOrders" : "")>

                <td style="max-width: none; overflow: visible;">
                    <div class="btn-group">
                        <a href="#" data-toggle="dropdown" class="btn dropdown-toggle"><i class="icon-cog"></i><span class="caret"></span></a>
                        <ul class="dropdown-menu dropdowm-right">
                            <li>
                                <a href="javascript:;" class="btn-vieworder" target="_blank">View Order</a>
                            </li>
                            <li>
                                <a href="javascript:;" class="btn-selectdeliverydate" target="_blank">Select Delivery Date</a>
                            </li>
                        </ul>
                    </div>
                </td>
                <td>@item.DatePlaced</td>
                <td>@item.OrderRef</td>
                <td>@item.Postcode</td>
                <td>@item.Customer</td>
                <td>@item.Telephone1</td>
                <td>@item.Mobile</td>
                <td>@item.Qty</td>
                <td>@item.Product</td>
                <td>@item.SpecialInstructions</td>
                <td>@item.WeightKG</td>
                <td>@item.Address</td>
                <td>@item.carrierName</td>
                <td>@item.Packages</td>
                <td>@item.Telephone2</td>
                <td>@item.ProdOptionID</td>
                <td>@item.OrderID</td>
                <td>@item.OrderItemID</td>
                <td>@item.LoadItemStatus</td>
            </tr>
        }
    </tbody>
</table>

<script>
    $(document).ready(function () {
        var height = $(window).height() - 180;
        $(".paragonUnplanOrderData table.krmtable").attr("data-height", height);
    })
</script>
